<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app"></div>
    <script src="../utils/js/old_version/react.development.js"></script>
    <script src="../utils/js/old_version/react-dom.development.js"></script>
    <script src="../utils/js/old_version/babel.min.js"></script>
    <script src="../utils/js/old_version/prop-types.js"></script>
    <script type="text/babel">
      class Demo extends React.Component {
        alert1 = () => {
          let { input1 } = this.refs; // 获取真实的dom
          alert(input1.value);
        };
        alert2 = () => {
          let { input2 } = this.refs; // 获取真实的dom
          alert(input2.value);
        };
        render() {
          // 字符串的ref 最老的写法，已不推荐了  写多了效率就不高了
          return (
            <div>
              <input type="text" placeholder="点击弹值" ref="input1" /> &nbsp;
              <span onClick={this.alert1}>点击弹左边的值</span>&nbsp;&nbsp;
              <input
                type="text"
                placeholder="失去焦点弹值"
                ref="input2"
                onBlur={this.alert2}
              />
            </div>
          );
        }
      }

      ReactDOM.render(<Demo />, document.getElementById("app"));
    </script>
  </body>
</html>
